<?php

namespace Gnway\Ticket\Rest\Contracts;

use Exception;

interface HookInterface
{

  /**
   * Hook class field
   */
  public const CLAZZ = 'clazz';

  /**
   * Hook includes path patterns field
   */
  public const INCLUDE_PATH_PATTERNS = 'include_path_patterns';

  /**
   * Hook excludes path patterns field
   */
  public const EXCLUDE_PATH_PATTERNS = 'exclude_path_patterns';

  /**
   * Method before
   */
  public const BEFORE = 'before';

  /**
   * Method after
   */
  public const AFTER = 'after';

  /**
   * Method exception
   */
  public const EXCEPTION = 'exception';

  /**
   * Method returning
   */
  public const RETURNING = 'returning';

  /**
   * Hook before
   *
   * @return mixed
   */
  public function before();

  /**
   * Hook after
   *
   * @return mixed
   */
  public function after();

  /**
   * Hook returning
   *
   * @param $response
   * @return mixed
   */
  public function returning($response);

  /**
   * Hook exception
   *
   * @param Exception $ex
   * @return mixed
   */
  public function exception(Exception $ex);

  /**
   * Check hook is alive
   *
   * @param string $hook
   * @return bool
   */
  public function isAlive(string $hook): bool;
}